// pages/detail-menu/detail-menu.js
import { getTopPlayList,getPlaylistHot } from "../../serive/music"

Page({
  data: {
    songMenus:[],
  },
  onLoad() {
    this.fetchPlaylistHot()
  },
  fetchPlaylistHot() {
    getPlaylistHot().then(res => {
        const tags = res.tags
        const allPromise = []
        for(let tag of tags) {
            const newPromise = getTopPlayList(tag.name,10)
            allPromise.push(newPromise)
        }
        Promise.all(allPromise).then(res => {
            this.setData({ songMenus: res})
        })
    })
  }
})